package com.itrip.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itrip.dao.ItripLabelDicMapper;
import com.itrip.entity.ItripLabelDic;
import com.itrip.service.ItripLabelDicService;
import com.itrip.vo.ItripLabelDicVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public
class ItripLabelDicServiceImpl extends ServiceImpl<ItripLabelDicMapper, ItripLabelDic> implements ItripLabelDicService{

 private static final Logger LOGGER = LoggerFactory.getLogger(ItripLabelDicServiceImpl.class);
 @Override
 public List<ItripLabelDic> chaxunjuedian(Long id) {
  ItripLabelDicMapper ldmapper=getBaseMapper();
  return ldmapper.chaxunjuedian(id);
 }

 @Override
 public List<ItripLabelDic> searchDetailsHote(Long id) {
  ItripLabelDicMapper ldmapper=getBaseMapper();

  return ldmapper.chaxunjuedian(id);
 }

 @Override
 public List<ItripLabelDicVO> getItripLabelDicByParentId() {
  List<ItripLabelDicVO> list=new ArrayList<>();
  Map<String,Object>map = new HashMap<>();
  ItripLabelDicMapper itripLabelDicMapper=getBaseMapper();
  map.put("parentId",107);
  List<ItripLabelDic> itripLabelDics = itripLabelDicMapper.selectByMap(map);
  for (ItripLabelDic itripLabelDic : itripLabelDics) {
   ItripLabelDicVO itripLabelDicVO=new ItripLabelDicVO();
   itripLabelDicVO.setId(itripLabelDic.getId());
   itripLabelDicVO.setName(itripLabelDic.getName());
   itripLabelDicVO.setDescription(itripLabelDic.getDescription());
   itripLabelDicVO.setPic(itripLabelDic.getPic());
   list.add(itripLabelDicVO);
  }
  return list;
 }
}
